<script setup>
defineProps(['cart'])
import {useCartStore} from '@/stores/modules/cart.js'
const {delCart} = useCartStore()
</script>
<template>
  <div class="cart-goods">
    <img :src="cart.picture" alt="" />
    <div class="goods-content">
      <h3 class="title ellipsis-2">{{ cart.name }}</h3>
      <span
        class="desc ellipsis"
        >{{ cart.attrsText}}</span
      >
    </div>
    <div class="goods-price">
      <span class="price">¥{{ cart.nowPrice}}</span>
      <span class="count">x{{ cart.count}}</span>
    </div>
    <div class="btn" @click="delCart(cart.skuId)">
      <span class="count">x</span>
    </div>
  </div>
</template>

<style lang="scss" scoped>
.cart-goods {
  display: flex;
  gap: 10px;

  img {
    width: 80px;
    height: 80px;
  }

  .goods-content {
    padding: 10px 0;

    display: flex;
    flex-direction: column;
    gap: 10px;
    height: 80px;
    width: 190px;

    .title {
      width: 100%;
      line-height: 16px;
      color: black;
      font-weight: normal;
    }

    .desc {
      display: block;
      color: #979191;
      width: 100%;
      font-size: 12px;
      line-height: 12px;
    }
  }

  .goods-price {
    padding: 10px 0;

    display: flex;
    flex-direction: column;
    gap: 10px;
    height: 80px;
    width: 100%;

    .price {
      color: red;

      .count {
        font-size: 10px;
      }
    }
  }
  .btn{
    line-height: 80px;
    span{
      font-size: 16px;
    }
  }
}
</style>
